﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using DinhMuc.Public;
using DinhMuc.DAL;
using System.Windows.Forms;

namespace DinhMuc.BUL
{
   public class tblDinhMucBUL
    {
        tblDinhMucDAL dmTP = new tblDinhMucDAL();
        public DataTable bangDMTP()
        {
            return dmTP.bangDinhMuc();
        }
        public void import(string sql, tblDinhMucPublic p)
        {
            dmTP.import(sql, p);
        }
        public DataTable bangDMTP(int soDH)
        {
            return dmTP.bangDinhMuc(soDH);
        }
        public DataTable dsNVL_bysoDH(int soDH)
        {
            return dmTP.dsNVL_bysoDH(soDH);
        }
        public DataTable dsPL_bysoDH(int soDH)
        {
            return dmTP.dsPL_bysoDH(soDH);
        }
        public DataTable dmNVL_bysoDH_NVL(int soDH,string maNVL)
        {
            return dmTP.dmNVL_bysoDH_NVL(soDH, maNVL);
        }
        public DataTable dsDinhMucTP1()
        {
            return dmTP.dsDinhMucTP();
        }
        public int themDM(tblDinhMucPublic p)
        {
            //int kq = 0;
            return dmTP.ThemDinhMuc(p);
            //if (kq > 0)
            //    MessageBox.Show("Thêm thành công");
            //else
            //    MessageBox.Show("Không Thành công!");

            //return kq;
        }
        public int suaDM(tblDinhMucPublic p)
        {
            int kq = 0;
            kq = dmTP.suaDinhMuc(p);
            if (kq > 0)
                MessageBox.Show("Sửa thành công");
            else
                MessageBox.Show("Sửa Thất Bại!");
            return kq;
        }
        public int xoaDM(int ID)
        {
            int kq = 0;
            kq = dmTP.xoaDinhMuc(ID);
            if (kq > 0)
                MessageBox.Show("Xóa Thành Công!");
            else
                MessageBox.Show("Xóa Thất Bại!");
            return kq;
        }
        public DataTable LoadToComBoBox_soDH()
        {
            return dmTP.LoadToComBoBox_soDH();
        }
        public DataTable LoadToComBoBox_maNVL()
        {
            return dmTP.LoadToComBoBox_maNVL();
        }
    }
}
